<?php
error_reporting(0);
include ('common/connection.php');
include('config/config.php');
include 'common/pagination.func.php';
if($_POST[delKey]==1)
	{
		$chkBox=$_POST[chkBox];
		//echo $chkBox;
		if(!empty($chkBox))
		{ //if_1
			foreach($chkBox as $i=>$v)
			{
				//$qryDelete="DELETE FROM users WHERE id=$i";
				mysql_db_query($db_name,$qryDelete);
				
				//header("location: containeradmin.php?area=product&action=product");
			}
		}
		
	}
	
	$operation = $_GET['del']; 
	$uid=$_GET['uid'];
	
	if($operation==1){
		$qryDelete="UPDATE users SET is_delete=1 WHERE id=$uid";
		mysql_db_query($db_name,$qryDelete);
	}
?>
<html>
<head>
<style type="text/css">
.style1{
       font-family:verdana,arial;
       font-weight:bold;
       font-size:12px;
       color: white;
}
.style11{
       font-family:verdana,arial;
       font-weight:bold;
       font-size:15px;
       color: white;
}

.style12{
       font-family:verdana,arial;
       font-weight:bold;
       font-size:12px;
       color: green;
}
.textD{
	FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: lucida grande, tahoma, verdana, arial, sans-serif; TEXT-DECORATION: none 
}
.text_D2 {
	FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: lucida grande, tahoma, verdana, arial, sans-serif; TEXT-DECORATION: none
}
.text_CIDDom {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: lucida grande, tahoma, verdana, arial, sans-serif; font-weight:normal; TEXT-DECORATION: none
}
.top_border {
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #009ACE;
}
.textPAGD {
	FONT-SIZE: 11px; COLOR:#0099CC ; FONT-FAMILY: lucida grande, tahoma, verdana, arial, sans-serif; TEXT-DECORATION: underline 
}
</style>
</head>
<script language="javascript">
function compdelete()
{
	//alert(id);
	msg="Are you sure, you want to delete this Department Name?";
	var t=window.confirm(msg);
	if (t)
	{
		//location.href="adminforum.php?area=forum_category&action=category&categoryId="+ID;
		document.list.action="containeradmin.php?area=department&action=department_view";
		document.list.submit();
	}
	else
	{
		return false;
	}
}
function check_all() {
for (i=0;i<document.list.length;i++) {
if (document.list.elements[i].type=='checkbox')
document.list.elements[i].checked=document.list.elements.reference.checked;
}
}
function update_all_checkbox() {
var all_checked = 1;
for (i=0;i<document.list.length;i++) {
if ( document.list.elements[i].type=='checkbox' &&
(!document.list.elements[i].checked) &&
document.list.elements[i].id != 'selectall' ) {
var all_checked = 0;
}
var allcheck = document.getElementById('selectall');
if (allcheck) {
allcheck.checked = all_checked;
}
}
}
function any_checked() {
var any_checked = 0;
for (i=0;i<document.list.length;i++) 
{
if ( document.list.elements[i].type=='checkbox' && document.list.elements[i].checked && document.list.elements[i].id != 'selectall' ) 
{
var any_checked = 1;
}
}
return any_checked;
}
</script>
<form name="list" action="#" method="post">
  <table width="100%" align="center" cellspacing="1">
    <tr>
      <td colspan="11" align="center" bgcolor="#D5F4DD" class="top_border"><table width="100%" border="0" cellspacing="0">
          <tr>
            <td align="center"><font color="#006699" face="Georgia, Times New Roman, Times, serif"><strong>View User</strong></font></td>
          </tr>
      </table></td>
    </tr>
    <tr bgcolor="#99CCCC">
      <td width="1%" align="center">&nbsp;</td>
      <td width="3%" align="center"><span class="text_D2">No.</span></td>
      <td width="22%" align="center"><span class="text_D2">Name</span></td>
      <td width="12%" align="center"><span class="text_D2">Nick Name</span></td>
      <td width="14%" align="center"><span class="text_D2">Cell No</span></td>
      <td width="15%" align="center"><span class="text_D2">Email</span></td>
      <td width="9%" align="center"><span class="text_D2">ID</span></td>
      <td width="9%" align="center"><span class="text_D2">Status</span></td>
      <td width="9%" align="center"><span class="text_D2">Reg.Date</span></td>
      <td colspan="2" align="center"><span class="text_D2">Action</span></td>
    </tr>
    <?php
	$c=0;
	resolve($db_name,"SELECT * FROM `users` where is_delete=0 ORDER BY created_date");
	$queryUser="SELECT * FROM `users` where is_delete=0 ORDER BY created_date LIMIT $start, $end";
	$resultUser=mysql_db_query($db_name,$queryUser);
	while($rsUser=mysql_fetch_array($resultUser))
	{
	$c++;
?>
    <tr bgcolor="#f8f8f8" height="20">
      <td colspan="2" align="center"><span class="text_D2"><?php echo $c; ?></span></td>
      <td width="22%" align="left"><span class="text_D2"><?php echo $rsUser['f_name'];?></span></td>
      <td width="12%" align="left"><span class="text_D2"><?php echo $rsUser['n_name'];?></span></td>
      <td width="14%" align="center"><span class="text_D2"><?php echo $rsUser['cell_num'];?></span></td>
      <td width="15%" align="center"><span class="text_D2"><?php echo $rsUser['email'];?></span></td>
      <td width="9%" align="center"><span class="text_D2"><?php echo $rsUser['verify'];?></span></td>
      <td width="9%" align="center"><span class="text_D2">
        <?php $userStatus=$rsUser['status']; if($userStatus==1){echo "<font color='red'>Paid</font>";}else{echo "Due";}?>
      </span></td>
      <td width="9%" align="center"><span class="text_D2"><?php echo $rsUser['created_date'];?></span></td>
      <td width="3%" align="center"><span class="text_D2"><a href="containeradmin.php?area=user&action=update_user&uid=<?php echo $rsUser['id'];?>" style="text-decoration:none">Edit</a></span></td>
      
      <td width="12%" align="left"><input type="checkbox" name="chkBox[<?php echo $rsUser['id'];?>]" value="<?php echo $rsUser['id'];?>" />
          <span class="text_D2"><a href="containeradmin.php?area=user&action=view_user&del=1&uid=<?php echo $rsUser['id'];?>">Delete</a></span></td>
    </tr>
    <?php
 }
?>
    <tr bgcolor="#f8f8f8" height="20">
      <td colspan="10" align="center">&nbsp;</td>
      <td align="left"><input type="checkbox" name="reference" value="checkbox" onClick="check_all()" />
          <span class="text_D2">Select all</span></td>
    </tr>
    <tr bgcolor="#f8f8f8" height="20">
      <td colspan="10" align="center">&nbsp;</td>
      <td align="left"><input type="submit" name="input" value="Delete" onClick="return compdelete()"/>
          <input type="hidden" name="delKey" value="1" /></td>
    </tr>
    <tr bgcolor="#f8f8f8" height="20">
      <td colspan="11" align="center"><?php include "common/navigation.php" ?></td>
    </tr>
  </table>
</form>
